<%- include('../public/page_header.html')%>

<div class="panel panel-default">
    <div class="panel-heading">
        <a href="/<%=adminPath%>/articleCate/add" class="btn btn-primary">增加分类</a>
    </div>
    <div class="table-responsive">
          <table class="table table-bordered">
            <thead>
                <tr class="th">
                    <th class="text-center">分类名称</th>
                    <th class="text-center">链接地址</th>
                    <th class="text-center">排序</th>
                    <th class="text-center">状态</th>
                    <th class="text-center">操作</th>
                </tr>
            </thead>
            <tbody>
                <% for(let i=0; i<list.length; i++){%>
                    <tr>
                        <td>
                          <%=list[i].title%>
                        </td>
                        <td class="text-center">
                          <span class="chSpanNum" data-id="<%=list[i]._id%>" data-model="ArticleCate" data-field="link">
                            <%=list[i].link%>
                          </span>
                        </td>
                        <td class="text-center">
                          <span class="chSpanNum" data-id="<%=list[i]._id%>" data-model="ArticleCate" data-field="sort">
                            <%=list[i].sort%>
                          </span>
                        </td>
                        <td class="text-center">
                          <% if(list[i].status == 1){%>
                            <img src="/admin/images/yes.png" class="chStatus" data-id="<%=list[i]._id%>" 
                                 data-model="ArticleCate" data-field="status">
                          <%}else{%>
                            <img src="/admin/images/no.png"  class="chStatus" data-id="<%=list[i]._id%>"
                                 data-model="ArticleCate" data-field="status">
                          <%}%>
                        </td>
                        <td class="text-center">
                            <a href="/<%=adminPath%>/articleCate/edit?id=<%=list[i]._id%>">修改</a>
                            <a class="delete" href="/<%=adminPath%>/articleCate/delete?id=<%=list[i]._id%>">删除</a>
                        </td>
                    </tr>
                    <% for(let j=0; j<list[i].items.length; j++){%>
                      <tr>
                          <td><div style="margin-left: 30px;"><%=list[i].items[j].title%></div></td>
                          <td class="text-center">
                            <span class="chSpanNum" data-id="<%=list[i].items[j]._id%>" data-model="ArticleCate" data-field="link">
                              <%=list[i].items[j].link%>
                            </span>
                          </td>
                          <td class="text-center">
                            <span class="chSpanNum" data-id="<%=list[i].items[j]._id%>" data-model="ArticleCate" data-field="sort">
                              <%=list[i].items[j].sort%>
                            </span>
                          </td>
                          <td class="text-center">
                            <% if(list[i].items[j].status == 1){%>
                              <img src="/admin/images/yes.png" class="chStatus" data-id="<%=list[i].items[j]._id%>" 
                                   data-model="ArticleCate" data-field="status">
                            <%}else{%>
                              <img src="/admin/images/no.png"  class="chStatus" data-id="<%=list[i].items[j]._id%>"
                                   data-model="ArticleCate" data-field="status">
                            <%}%>
                          </td>
                          <td class="text-center">
                              <a href="/<%=adminPath%>/articleCate/edit?id=<%=list[i].items[j]._id%>">修改</a>
                              <a class="delete" href="/<%=adminPath%>/articleCate/delete?id=<%=list[i].items[j]._id%>">删除</a>
                          </td>
                      </tr>
                    <%}%>
                <%}%>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>